#ifndef utils_h
#define utils_h


#include <stdio.h>
#include <stdint.h>


#define MAJOR_VERSION 0
#define MINOR_VERSION 3
#ifdef NDEBUG
#  define BUILD_SUFFIX ""
#else
#  define BUILD_SUFFIX "-dbg"
#endif
#define STRINGIZE_2(x) #x
#define STRINGIZE(x) STRINGIZE_2(x)
#define VERSION_STRING \
  STRINGIZE(MAJOR_VERSION) "." STRINGIZE(MINOR_VERSION) \
  "-r" SVN_REVISION BUILD_SUFFIX

/*
 * Remove spaces from the begin and the end of s.
 *
 * The first space character of the suffix is replaced by a null
 * terminator. A pointer to the first non-space character is returned.
 */
char* trim_string(char* s);

/*
 * Return a (precomputed) random number.
 *
 * Any value between 0 and 2^64 - 1 can be returned.
 */
uint64_t random64();

/*
 * Print on f a time representation of seconds.
 *
 * The format is dd day(s) hh hour(s), mm minute(s), and ss.cc
 * seconds.  Days, hours and minutes are printed only if non
 * zero. seconds must be a non negative.
 */
void print_time(FILE* f, double seconds);


#endif  // utils_h
